<?php
$action=$_GET["action"];
if($action=="delete1") {
    $id = $_GET["id"];
    $link = mysqli_connect("localhost", "root", "123", 'Dress', '3306');
    mysqli_query($link, "set names 'utf8'");
    $sql = "delete from user where username = '$id'";
    $result = mysqli_query($link,$sql);
    if ($result) {
        header("location:member-list.php");  //删除成功，则跳转回显示页面
    } else {
        echo "删除失败！";
    }
}

if($action=="delete2") {
    $id = $_GET["id"];
    $link = mysqli_connect("localhost", "root", "123", 'Dress', '3306');
    mysqli_query($link, "set names 'utf8'");
    $sql = "delete from style where title = '$id'";
    $result = mysqli_query($link,$sql);
    if ($result) {
        header("location:dapei-list.php");  //删除成功，则跳转回显示页面
    } else {
        echo "删除失败！";
    }
}

if($action=="delete3") {
    $id = $_GET["id"];
    $link = mysqli_connect("localhost", "root", "123", 'Dress', '3306');
    mysqli_query($link, "set names 'utf8'");
    $sql = "delete from goods where name = '$id'";
    $result = mysqli_query($link,$sql);
    if ($result) {
        header("location:goods-list.php");  //删除成功，则跳转回显示页面
    } else {
        echo "删除失败！";
    }
}

if($action=="delete4") {
    session_start();
    $id = $_GET["id"];                                
    $username = $_SESSION['user'];
    $link = mysqli_connect("localhost", "root", "123", 'Dress', '3306');
    mysqli_query($link, "set names 'utf8'");
    $sql = "delete from shopcard where product = '$id' and username ='$username'";
    $result = mysqli_query($link,$sql);
    if ($result) {
        header("location:shop-cart.php");  //删除成功，则跳转回显示页面
    } else {
        echo "删除失败！";
    }
}
?>